<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>统计成绩最大值和最小值</title>
    <script>
        function calculateStats() {
            var arr = [];
            var sum = 0;
            var max = 0;
            var min = 100;
        
            for (var i = 1; i <= 5; i++) {
                var score = parseFloat(document.getElementById("score" + i).value);
                arr.push(score);
                sum += score;
                
                if (score > max) {
                    max = score;
                }
                
                if (score < min) {
                    min = score;
                }
            }
        
            var average = sum / 5;
        
            alert("总分：" + sum + "\n平均分：" + average.toFixed(2) + "\n最高分：" + max + "\n最低分：" + min);
        }
        </script>
        </head>
        <body>
        <label for="score1">科目1成绩：</label>
        <input type="text" id="score1"><br>
        <label for="score2">科目2成绩：</label>
        <input type="text" id="score2"><br>
        <label for="score3">科目3成绩：</label>
        <input type="text" id="score3"><br>
        <label for="score4">科目4成绩：</label>
        <input type="text" id="score4"><br>
        <label for="score5">科目5成绩：</label>
        <input type="text" id="score5"><br>
        
        <button onclick="calculateStats()">计算成绩统计信息</button>
        </body>
        </html>